package demo3;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * DAO Date Access Object
 * DAO
 */
@Component
public class UserDAO {
    //连接数据库时的地址
    //@Value注解可以被标注在属性上,Spring创建对象时会根据注解的参数来初始化该属性的值
    @Value("jdbc:mysql://localhost:3308/tedu")
    private String url;
    @Value("root")
    //数据库用户名
    private String username;
    @Value("1234")
    //数据库密码
    private String password;

    @Override
    public String toString() {
        return "UserDAO{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
